#include <pybind11/pybind11.h>
#include "Utility.h"

namespace py = pybind11;

void bind_utility(py::module_ m);

PYBIND11_MODULE(utility, m) {
    bind_utility(m);
}

void bind_utility(py::module_ utility) {
    py::class_<BitUtility>(utility, "BitUtility")
        .def_static("bitWidth", &BitUtility::bitWidth)
        .def_static("align_greater_equal", &BitUtility::alignGreaterEqual)
    ;

    py::class_<Bit>(utility, "Bit")
        .def(py::init<unsigned int>())
        .def("bindex", &Bit::bindex)
        .def("value", &Bit::value)
        .def("mask", &Bit::mask)
        .def("clear", &Bit::clear)
        .def("set", &Bit::set)
        .def("is_set", &Bit::isSet)
        .def("is_clear", &Bit::isClear)
    ;
}

